//
//  THCPCMyPublishCompleteDVC.m
//  YJB
//
//  Created by 中电大维 on 2017/1/5.
//  Copyright © 2017年 YJB. All rights reserved.
//

#import "THCPCMyPublishCompleteDVC.h"

@interface THCPCMyPublishCompleteDVC ()

@end

@implementation THCPCMyPublishCompleteDVC
{
    UIImageView *_userIcon;
    UILabel *_userName;
    UILabel *_taskTime;
    UITextField *_result;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"完成详情";
    [self addSubView];
    [self test];
    self.view.backgroundColor = kUIColorFromRGB(0xeeeeee);
}
- (void)read:(UIButton *)button
{

}

- (void)report:(UIButton *)button
{

}
- (void)test
{
    _userName.text = @"18676727214";
    _taskTime.text = @"2017.01.05";
}
- (void)addSubView
{
    UIView *userView = [[UIView alloc] init];
    userView.backgroundColor = [UIColor whiteColor];
    [userView.layer setMasksToBounds:YES];
    [userView.layer setCornerRadius:3.0];
    
    _userIcon = [[UIImageView alloc] init];
    _userIcon.image = Image(@"th_cpc_default_normal");
    
    _userName = [[UILabel alloc] init];
    _userName.textColor = kUIColorFromRGB(0x333333);
    _userName.font = FONT(15);
    
    _taskTime = [[UILabel alloc] init];
    _taskTime.textColor = kUIColorFromRGB(0x666666);
    _taskTime.font = FONT(13);
    _taskTime.textAlignment = NSTextAlignmentRight;
    [self.view addSubview:userView];
    [userView addSubview:_userIcon];
    [userView addSubview:_userName];
    [userView addSubview:_taskTime];
    
    [userView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(10);
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(52);
    }];
    [_userIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(7.5);
        make.left.mas_equalTo(7);
        make.bottom.mas_equalTo(-7.5);
        make.width.equalTo(_userIcon.mas_height);
    }];
    [_userName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(userView.mas_centerY);
        make.left.equalTo(_userIcon.mas_right).offset(10);
        make.width.equalTo(userView.mas_width).multipliedBy(0.6);
        make.height.equalTo(userView.mas_height);
    }];
    [_taskTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(userView.mas_centerY);
        make.right.equalTo(userView.mas_right).offset(-5);
        make.width.mas_equalTo(100);
        make.height.equalTo(userView.mas_height);
    }];
    
    UIView *resultView = [[UIView alloc] init];
    resultView.backgroundColor = [UIColor whiteColor];
    [resultView.layer setMasksToBounds:YES];
    [resultView.layer setCornerRadius:5.0];
    
    UILabel *resultLabel = [[UILabel alloc] init];
    resultLabel.textColor = kUIColorFromRGB(0x333333);
    resultLabel.font = FONT(15);
    resultLabel.text = @"提交结果:";
    
    _result = [[UITextField alloc] init];
    _result.backgroundColor = kUIColorFromRGB(0xf4f4f4);
    [_result.layer setMasksToBounds:YES];
    [_result.layer setCornerRadius:3.0];
    [_result.layer setBorderWidth:0.5];
    [_result.layer setBorderColor:kUIColorFromRGB(0xff783c).CGColor];
    
    UIButton *readButton = [[UIButton alloc] init];
    UIButton *reportButton = [[UIButton alloc] init];
    
    readButton.backgroundColor = kUIColorFromRGB(0xff783c);
    reportButton.backgroundColor = kUIColorFromRGB(0x7196e2);
    
    [readButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [reportButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [readButton setTitle:@"标为已读" forState:UIControlStateNormal];
    [reportButton setTitle:@"举报" forState:UIControlStateNormal];
    
    [readButton.layer setCornerRadius:3.0];
    [readButton.layer setMasksToBounds:YES];
    [reportButton.layer setCornerRadius:3.0];
    [reportButton.layer setMasksToBounds:YES];
    
    [readButton addTarget:self action:@selector(read:) forControlEvents:UIControlEventTouchUpInside];
    [reportButton addTarget:self action:@selector(report:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:resultView];
    [resultView addSubview:resultLabel];
    [resultView addSubview:_result];
    [resultView addSubview:readButton];
    [resultView addSubview:reportButton];
    
    [resultView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.top.equalTo(userView.mas_bottom).offset(5);
        make.bottom.mas_equalTo(10);
    }];
    
    [resultLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(12);
        make.right.mas_equalTo(-12);
        make.top.mas_equalTo(20);
        make.height.mas_equalTo(15);
    }];
    [_result mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(resultLabel.mas_left);
        make.right.equalTo(resultLabel.mas_right);
        make.top.equalTo(resultLabel.mas_bottom).offset(15);
        make.height.mas_equalTo(34);
    }];
    [readButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(53);
        make.top.equalTo(_result.mas_bottom).offset(60);
        make.height.mas_equalTo(44);
    }];
    [reportButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(readButton.mas_right).offset(50);
        make.right.equalTo(resultView.mas_right).offset(-53);
        make.top.equalTo(readButton.mas_top);
        make.height.equalTo(readButton.mas_height);
        make.width.equalTo(readButton.mas_width);
    }];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
